package com.glodon.zhuanli.system.entity;

import com.glodon.framework.jpa.entity.JPABaseEntity;
import com.glodon.framework.jpa.entity.JPASoftDelEntity;
import com.glodon.zhuanli.ZLConstants;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 角色管理实体对象
 */
@Entity
@Table(name="sys_role")
@Setter
@Getter
public class SysRole extends JPABaseEntity implements JPASoftDelEntity {

	/**
	 * 名称
	 */
	@Column(name="name")
	private String name ;


	/**
	 * 编码
	 */
	@Column(name="code")
	private String code ;


	/**
	 * 角色类型
	 */
	@Column(name="type")
	private String type = "CUSTOM" ;

	/**
	 * 企业id
	 */
	@Column(name="company_id")
	private String companyId ;

	@Column
	private String source = ZLConstants.RECORD_SOURCE.SYSTEM;


	private Boolean del = false ;

	@Override
	public Boolean getDel() {
		return del;
	}

	@Override
	public void setDel(Boolean del) {
		this.del = del==null ? false : del ;
	}

	/**
	 * 默认的角色类型为CUSTOM
	 * @return
	 */
	public String getType(){
		return StringUtils.isBlank(type) ? "CUSTOM" : type ;
	}


}